<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ request.getContextPath() + "/";
%>
<base href="<%=basePath%>" />
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<head>
<link href="./css/cms/skin.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script src="./common/js/jquery-1.7.1.js" type="text/javascript"></script>
<script type="text/javascript" src="./js/cms/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript" src="./js/cms/jBox/jquery.jBox-zh-CN.js"></script>
<script type="text/javascript" src="./common/js/cmsBase.js"></script>
<link type="text/css" rel="stylesheet" href="./css/cms/jbox/jbox.css"/>
<link type="text/css" rel="stylesheet" href="./css/cms/cmsbase.css"/>

</head>
<body class="body">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="17" valign="top" background="./images/mail_leftbg.gif"><img
				src="./images/left-top-right.gif" width="17" height="29" /></td>
			
			<td valign="top" background="./images/content-bg.gif" class="image_icon">
				<img alt="添 加" onclick="addAuditPower()" title="添 加" src="./images/add.gif">
			</td>
			
			<td width="16" valign="top" background="./images/mail_rightbg.gif"><img
				src="./images/nav-right-bg.gif" width="16" height="29" /></td>
		</tr>
		<tr>
			<td valign="middle" background="./images/mail_leftbg.gif">&nbsp;</td>
			<td valign="top" bgcolor="#F7F8F9"><table width="98%" border="0"
					align="center" cellpadding="0" cellspacing="0">
					<tr>
						<td colspan="4" valign="top">&nbsp;</td>
					</tr>
					<tr>
						<td colspan="5" width="40%" valign="top">
						<table width="100%"	height="144" border="0" cellpadding="0" cellspacing="0">
								<tr >
									<td height="27" class="father_td_first"></td>
									<td class="father_td"></td>
								</tr>
								<tr>
									<td height="102" colspan="4" valign="top">
										<table cellSpacing=0 cellPadding=0 class="result_table">
												<tr>
													<th>名称</th>
													<th>编码</th>
												</tr>
												<c:choose>
													<c:when test="${result!=null && fn:length(result) > 0}">
														<c:forEach items="${result }" var="auditPower">
															<tr>
																<td>${auditPower.name}</td>
																<td>${auditPower.code}</td>
															</tr>
														</c:forEach>
													</c:when>
													<c:otherwise>
														<tr>
															<td colspan="2">当前没有任何数据……</td>
														</tr>
													</c:otherwise>
												</c:choose>
										</table>
									</td>
								</tr>
							</table></td>
					</tr>

					<tr>
						<td width="2%">&nbsp;</td>
						<td width="51%" class="left_txt"><img
							src="./images/icon-mail2.gif" width="16" height="11">
							客户服务邮箱：215288671@qq.com<br> <img
							src="./images/icon-phone.gif" width="17" height="14">
							官方网站：http://www.maishadg.com</td>
						<td colspan="2">&nbsp;</td>
					</tr>
				</table></td>
		</tr>
		<tr>
			<td valign="bottom" background="./images/mail_leftbg.gif"><img
				src="./images/buttom_left2.gif" width="17" height="17" /></td>
			<td background="./images/buttom_bgs.gif"><img
				src="./images/buttom_bgs.gif" width="17" height="17"></td>
			<td valign="bottom" background="./images/mail_rightbg.gif"><img
				src="./images/buttom_right2.gif" width="16" height="17" /></td>
		</tr>
	</table>
</body>
<script type="text/javascript">
<!--
	function addAuditPower(){
		var buttons = { '确 定':1,'关 闭': 2 };
		cmsbase.showFormPage("cms/addPower.htm","添加权限",buttons,500,300,callBack);
	}
	
	function callBack(v, h, f){
		if(v==1){
			var name = $("#name").val();
			var code = $("#code").val();
			if($.trim(name)==""){
				cmsbase.infoMsg("名称不能为空！");
				return false;
			}
			if($.trim(code)==""){
				cmsbase.infoMsg("编码不能为空！");
				return false;
			}
			$("#auditPower").submit();
			return true;
    	}else if(v==2){
    		return true;
    	}
	}
	//修改权限的级别
	function changePowerLevel(thisDom){
		var value = $(thisDom).val();
		switch (value) {
		case "1":
			break;
		case "2":
			//获得一级权限的名称
			getResultPowerSelect(1);
			break;
		case "3":
			//获得一级权限的名称 //插入二级权			

			break;
		default:
			cmsbase.infoMsg("您必须输入1-3 的有效数字！");
			break;
		}
	}
	//获得节点 拼装成select	
	function getResultPowerSelect(level,parentId){
		var url = "cms/getPowerByLevel.htm";
		var param={
			level :level,
			parentId : parentId,
		};
		cmsbase.getResultByPram_json(url,param,selectCallBack);
	}
	
	//拼装select
	function selectCallBack(data){
		var result = "<select onchange='powerLeve1Change(this)' name='parentId'>";
		$.each(data,function(index,item){
			result += "<option style='width:100px;' value='"+item.id+"'>"
			result+=item.name;
			result+="</option>";
		});
		result +="</select>"
		$("#powerLeve1").html(result);
	}
		
	function powerLeve1Change(thisDom){
		var parentId= $(thisDom).val();
		getResultPowerSelect(2,parentId);
	}
	
//-->
</script>

